import request from '@/config/axios'
import type { OpenUser } from './types'

export const getOpenUsersListApi = (params: any): Promise<IResponse> => {
  return request.get({ url: '/open-users', params })
}

export const updateOpenUsersApi = (id: string, data: Partial<OpenUser>): Promise<IResponse> => {
  return request.put({ url: `/open-users/id/${id}`, data })
}

export const getOpenUsersDetailApi = (id: string): Promise<IResponse<OpenUser>> => {
  return request.get({ url: `/open-users/id/${id}` })
}

export const delOpenUsersListApi = (ids: string[] | number[]): Promise<IResponse> => {
  return request.delete({ url: `/open-users/id/${ids[0]}` })
}
